fix(video): return pathlib.Path from Video.path() - #3197
Open
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Open
fix(video): return pathlib.Path from Video.path()#3197Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Conversation
Video.path() is annotated -> pathlib.Path and the generated API documents it as such, but it returned Artifact.absolute_path, which is the raw initializer string. The wrap was dropped in 0c70108 when Video moved onto the Artifact abstraction; the sibling Download.path() still wraps via Artifact.path_after_finished().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Video.path()is annotated-> pathlib.Pathand the generated API documentsReturns: pathlib.Path, but it returnsArtifact.absolute_path, which is the rawinitializer["absolutePath"]string.The wrap was dropped in 0c70108 ("roll to ... aka video", Apr 2021) when
Videomoved onto theArtifactabstraction. Before that commit it didpathlib.Path(os.path.join(...)). The siblingDownload.path()still wraps correctly viaArtifact.path_after_finished().Video.path()is the only consumer ofabsolute_path.mypy does not catch it:
ChannelOwner.__init__takes a bareinitializer: Dict, soabsolute_pathinfers asAnyand satisfies any declared return type.mypy playwrightreports the same 2 pre-existing errors before and after.Fail-before, real Chromium recording a real video:
After:
tests/async/test_video.py5/5 andtests/sync/test_video.py6/6 pass. Added theisinstanceassertion to both so the contract is guarded; every existing assertion wrapped instr(...), which is why this stayed invisible.pre-commit run --fileson the three files: 15 hooks, 0 errors.🤖 Generated with Claude Code